package com.leonzx.base.config.quartz;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.Properties;

/**
 * @Author:梁亮
 * @Description:
 * @Date: 2018/7/5 14:58
 */
@ConfigurationProperties(prefix = "quartz")
public class QuartzProperties {
    private String instanceName;
    private String export;
    private String proxy;
    private String wrapJobExecutionInUserTransaction;

    private String threadPoolClass;
    private String threadCount;
    private String threadPriority;
    private String threadsInheritContextClassLoaderOfInitializingThread;

    private String misfireThreshold;

    private String jobStoreClass;
    private String driverDelegateClass;
    private String tablePrefix;
    private String dataSource;
    private String driver;
    private String url;
    private String user;
    private String password;
    private String maxConnections;

    public String getInstanceName() {
        return instanceName;
    }

    public void setInstanceName(String instanceName) {
        this.instanceName = instanceName;
    }

    public String getExport() {
        return export;
    }

    public void setExport(String export) {
        this.export = export;
    }

    public String getProxy() {
        return proxy;
    }

    public void setProxy(String proxy) {
        this.proxy = proxy;
    }

    public String getWrapJobExecutionInUserTransaction() {
        return wrapJobExecutionInUserTransaction;
    }

    public void setWrapJobExecutionInUserTransaction(String wrapJobExecutionInUserTransaction) {
        this.wrapJobExecutionInUserTransaction = wrapJobExecutionInUserTransaction;
    }

    public String getThreadPoolClass() {
        return threadPoolClass;
    }

    public void setThreadPoolClass(String threadPoolClass) {
        this.threadPoolClass = threadPoolClass;
    }

    public String getThreadCount() {
        return threadCount;
    }

    public void setThreadCount(String threadCount) {
        this.threadCount = threadCount;
    }

    public String getThreadPriority() {
        return threadPriority;
    }

    public void setThreadPriority(String threadPriority) {
        this.threadPriority = threadPriority;
    }

    public String getThreadsInheritContextClassLoaderOfInitializingThread() {
        return threadsInheritContextClassLoaderOfInitializingThread;
    }

    public void setThreadsInheritContextClassLoaderOfInitializingThread(String threadsInheritContextClassLoaderOfInitializingThread) {
        this.threadsInheritContextClassLoaderOfInitializingThread = threadsInheritContextClassLoaderOfInitializingThread;
    }

    public String getMisfireThreshold() {
        return misfireThreshold;
    }

    public void setMisfireThreshold(String misfireThreshold) {
        this.misfireThreshold = misfireThreshold;
    }

    public String getJobStoreClass() {
        return jobStoreClass;
    }

    public void setJobStoreClass(String jobStoreClass) {
        this.jobStoreClass = jobStoreClass;
    }

    public String getDriverDelegateClass() {
        return driverDelegateClass;
    }

    public void setDriverDelegateClass(String driverDelegateClass) {
        this.driverDelegateClass = driverDelegateClass;
    }

    public String getTablePrefix() {
        return tablePrefix;
    }

    public void setTablePrefix(String tablePrefix) {
        this.tablePrefix = tablePrefix;
    }

    public String getDataSource() {
        return dataSource;
    }

    public void setDataSource(String dataSource) {
        this.dataSource = dataSource;
    }

    public String getDriver() {
        return driver;
    }

    public void setDriver(String driver) {
        this.driver = driver;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getMaxConnections() {
        return maxConnections;
    }

    public void setMaxConnections(String maxConnections) {
        this.maxConnections = maxConnections;
    }

    public Properties getProperties() {
        Properties properties = new Properties();
        properties.setProperty("org.quartz.scheduler.instanceName", instanceName);
        properties.setProperty("org.quartz.scheduler.rmi.export", export);
        properties.setProperty("org.quartz.scheduler.rmi.proxy", proxy);
        properties.setProperty("org.quartz.scheduler.wrapJobExecutionInUserTransaction", wrapJobExecutionInUserTransaction);
        properties.setProperty("org.quartz.threadPool.class", threadPoolClass);
        properties.setProperty("org.quartz.threadPool.threadCount", threadCount);
        properties.setProperty("org.quartz.threadPool.threadPriority", threadPriority);
        properties.setProperty("org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread", threadsInheritContextClassLoaderOfInitializingThread);
        properties.setProperty("org.quartz.jobStore.misfireThreshold", misfireThreshold);
        properties.setProperty("org.quartz.jobStore.class", jobStoreClass);
        properties.setProperty("org.quartz.jobStore.driverDelegateClass", driverDelegateClass);
        properties.setProperty("org.quartz.jobStore.tablePrefix", tablePrefix);
        properties.setProperty("org.quartz.jobStore.dataSource", dataSource);
        properties.setProperty("org.quartz.dataSource.qzDS.driver", driver);
        properties.setProperty("org.quartz.dataSource.qzDS.URL", url);
        properties.setProperty("org.quartz.dataSource.qzDS.user", user);
        properties.setProperty("org.quartz.dataSource.qzDS.password", password);
        properties.setProperty("org.quartz.dataSource.qzDS.maxConnections", maxConnections);
        return properties;
    }
}
